package cn.heima.com;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;

public class CollectionStudentDemo {
    public static void main(String[] args) {
        ArrayList<Student> array = new ArrayList<>();
        Student lisi = new Student("lisi", 24);
        Student zhangsan = new Student("zhangsan", 23);

        array.add(lisi);
        array.add(zhangsan);

        Iterator<Student> it = array.iterator();
        while (it.hasNext()){
           Student student= it.next();
            System.out.println(student);
        }


    }
}
